<template>
	<div class="audit-wrapper">
		<div class="head">
			<span class="title">
				收益审核详情
			</span>
			<div class="right-btn">
				<el-button plain @click="goBack">
					{{ $t('common.back') }}
				</el-button>
			</div>
		</div>
		<div class="audit-content detailBoxStyle flex-row-container">
			<div class="tree-box mr15">
				<CommonProxyTree
					ref="proxyTree"
					:selectedData.sync="selectedData"
					:detailData="detailData"
					:createdAtEnd="proxyCreatedAtEnd"
				/>
			</div>
			<div class="treeRight">
				<div v-if="selectedData.type === 1">
					<div class="contentBox mt30">
						代理账号信息
					</div>
					<el-table
						v-loading="loading"
						element-loading-spinner="el-icon-loading"
						size="mini"
						class="small-size-table"
						:data="[1]"
						style="width: 100%; margin: 15px 0"
						:header-cell-style="getRowClass"
						highlight-current-row
					>
						<el-table-column
							prop="userName"
							align="center"
							label="代理账号"
						>
							<template slot-scope="scope">
								{{ proxyAccountInfo.userName }}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="代理层级"
						>
							<template slot-scope="scope">
								{{ proxyAccountInfo.proxyLevel }}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="直属上级"
						>
							<template slot-scope="scope">
								{{ proxyAccountInfo.parentProxyName || '-' }}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="总代"
						>
							<template slot-scope="scope">
								{{ proxyAccountInfo.topProxyName }}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="业务模式"
						>
							<template slot-scope="scope">
								{{
									mappingBusinessModel(
										proxyAccountInfo.businessModel
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							key="accountStatus"
							prop="accountStatus"
							align="center"
							:label="$t('common.account_status')"
							min-width="115"
						>
							<template slot-scope="scope">
								<span
									v-if="!!proxyAccountInfo.paymentLockStatus"
									class="deleteRgba"
								>
									{{ $t('agent.charge_lock') }}
									<br />
								</span>
								<span v-if="false">
									{{ $t('agent.login_lock') }}：
								</span>
								<span
									v-if="!!proxyAccountInfo.loginLockStatus"
									class="disableRgba"
								>
									{{ $t('agent.login_lock') }}
								</span>
								<span
									v-if="!!proxyAccountInfo.gameLockStatus"
									class="lockingRgba"
								>
									{{ $t('agent.game_lock') }}
								</span>
								<span
									v-if="
										proxyAccountInfo.loginLockStatus ===
											0 &&
											proxyAccountInfo.paymentLockStatus ===
												0
									"
									class="normalRgba"
								>
									{{ $t('agent.normal') }}
								</span>
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="注册时间"
						>
							<template slot-scope="scope">
								{{ proxyAccountInfo.createdAt || '-' }}
							</template>
						</el-table-column>
					</el-table>
					<div class="contentBox mt30">
						{{
							dayjs(
								String(detailData.startTime),
								'YYYYMMDD'
							).format('YYYY-MM-DD')
						}}
						-
						{{
							dayjs(
								String(detailData.endTime),
								'YYYYMMDD'
							).format('YYYY-MM-DD')
						}}
						期代理收益统计
					</div>
					<el-table
						v-loading="loading"
						element-loading-spinner="el-icon-loading"
						size="mini"
						class="small-size-table"
						:data="proxyIncomeList"
						style="width: 100%; margin: 15px 0"
						:header-cell-style="getRowClass"
						highlight-current-row
					>
						<el-table-column
							prop="userName"
							align="center"
							label="收益状态"
						>
							<template slot-scope="scope">
								<span
									v-if="scope.row.payoutStatus === 6"
									class="disableRgba"
								>
									已取消
								</span>
								<span
									v-if="scope.row.payoutStatus === 3"
									class="normalRgba"
								>
									已发放
								</span>
								<span
									v-if="scope.row.payoutStatus === 1"
									class="lockingRgba"
								>
									待发放
								</span>
								<span
									v-if="scope.row.payoutStatus === 5"
									class="deleteRgba"
								>
									无收益
								</span>
								<span
									v-if="scope.row.payoutStatus === 0"
									class="deleteRgba"
								>
									未结算
								</span>
								<span
									v-if="scope.row.payoutStatus === 2"
									class="deleteRgba"
								>
									待领取
								</span>
								<span
									v-if="scope.row.payoutStatus === 4"
									class="deleteRgba"
								>
									超时未领取
								</span>
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="本期收益"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.currentIncomeAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="收益调整"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.adjustIncomeAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="调整后收益"
						>
							<template
								slot="header"
								slot-scope="{ column, $index }"
							>
								<span>
									调整后收益
									<el-tooltip
										class="item"
										effect="dark"
										content="如果实发收益为负数，则记账的时候该代理的现金余额累加该数值，如果累加后现金余额为负数，则现金余额记录为负数；"
										placement="top-start"
									>
										<i class="el-icon-question"></i>
									</el-tooltip>
								</span>
							</template>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.realIncomeAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="备注"
						>
							<template slot-scope="scope">
								<span>
									{{
										scope.row.audit1Desc
											? `${$t(
													'funds.proxy_member_funds_record.frirst_audit'
											  )}：${scope.row.audit1Desc}`
											: '-'
									}}
									<br v-show="scope.row.audit2Desc" />
									{{
										scope.row.audit2Desc
											? `${$t(
													'funds.proxy_member_funds_record.second_audit'
											  )}：${scope.row.audit2Desc}`
											: '-'
									}}
								</span>
							</template>
						</el-table-column>
					</el-table>
					<div class="contentBox mt30">
						收益详情
					</div>
					<el-table
						v-loading="loading"
						element-loading-spinner="el-icon-loading"
						size="mini"
						class="small-size-table"
						:data="incomeAuditDetail1"
						style="width: 100%; margin: 15px 0"
						:header-cell-style="getRowClass"
						highlight-current-row
					>
						<el-table-column
							prop="userName"
							align="center"
							label="项目"
						>
							德州俱乐部
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="服务费贡献"
							width="200"
						>
							<template
								slot="header"
								slot-scope="{ column, $index }"
							>
								<span>
									服务费贡献
									<el-tooltip
										class="item"
										effect="dark"
										content="服务费贡献=手牌服务费贡献+局服务费贡献"
										placement="top-start"
									>
										<i class="el-icon-question"></i>
									</el-tooltip>
								</span>
							</template>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.clubAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="团队分成比例"
						>
							<template slot-scope="scope">
								{{ scope.row.rebateRate }}%
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="团队分成金额"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.rebateAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="直属代理团队分成金额"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.underProxyAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="会员代理返水"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.memberRebateAmountByProxy
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="实际应发分成金额"
						>
							<template
								slot="header"
								slot-scope="{ column, $index }"
							>
								<span>
									实际应发分成金额
									<el-tooltip
										class="item"
										effect="dark"
										content="实际应发分成金额=团队分成金额-直属代理团队分成金额-会员代理返水"
										placement="top-start"
									>
										<i class="el-icon-question"></i>
									</el-tooltip>
								</span>
							</template>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.incomeAmount
									)
								}}
							</template>
						</el-table-column>
					</el-table>
					<el-table
						v-loading="loading"
						element-loading-spinner="el-icon-loading"
						size="mini"
						class="small-size-table"
						:data="incomeAuditDetail1"
						style="width: 100%; margin: 15px 0"
						:header-cell-style="getRowClass"
						highlight-current-row
					>
						<el-table-column
							prop="userName"
							align="center"
							label="项目"
						>
							德州保险
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="会员游戏输赢"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.netAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="团队分成比例"
						>
							<template slot-scope="scope">
								{{ scope.row.zhanchengRate }}%
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="团队分成金额"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.commissionNetAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="直属代理团队分成金额"
						>
							<template slot-scope="scope">
								<p
									:style="
										handleNumberColor(
											scope.row.underProxyNetAmount
										)
									"
								>
									{{
										handleTotalNumber(
											'USDT',
											scope.row.underProxyNetAmount
										)
									}}
								</p>
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="实际应发分成金额"
						>
							<template
								slot="header"
								slot-scope="{ column, $index }"
							>
								<span>
									实际应发分成金额
									<el-tooltip
										class="item"
										effect="dark"
										content="实际应发分成金额=团队分成金额-直属代理团队分成金额"
										placement="top-start"
									>
										<i class="el-icon-question"></i>
									</el-tooltip>
								</span>
							</template>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.incomeNetAmount
									)
								}}
							</template>
						</el-table-column>
					</el-table>
					<el-table
						v-loading="loading"
						element-loading-spinner="el-icon-loading"
						size="mini"
						class="small-size-table"
						:data="incomeAuditDetail3"
						style="width: 100%; margin: 15px 0"
						:header-cell-style="getRowClass"
						highlight-current-row
					>
						<el-table-column
							prop="userName"
							align="center"
							label="项目"
						>
							德州增值服务
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="增值服务纯利"
							width="200"
						>
							<template slot-scope="scope">
								<!-- <el-link
									class="lightBlueColor"
									type="primary"
									@click="clubAmountDialogFn(scope.row)"
								>
									{{
										handleTotalNumber(
											'USDT',
											scope.row.clubAmount
										)
									}}
								</el-link> -->
								{{
									handleTotalNumber(
										'USDT',
										scope.row.clubAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="团队分成比例"
						>
							<template slot-scope="scope">
								{{ scope.row.rebateRate }}%
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="团队分成金额"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.rebateAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="直属代理团队分成金额"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.underProxyAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="实际应发分成金额"
						>
							<template
								slot="header"
								slot-scope="{ column, $index }"
							>
								<span>
									实际应发分成金额
									<el-tooltip
										class="item"
										effect="dark"
										content="实际应发分成金额=团队分成金额-直属代理团队分成金额"
										placement="top-start"
									>
										<i class="el-icon-question"></i>
									</el-tooltip>
								</span>
							</template>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.incomeAmount
									)
								}}
							</template>
						</el-table-column>
					</el-table>
					<el-table
						v-loading="loading"
						element-loading-spinner="el-icon-loading"
						size="mini"
						class="small-size-table"
						:data="incomeAuditDetail2"
						style="width: 100%; margin: 15px 0"
						:header-cell-style="getRowClass"
						highlight-current-row
					>
						<el-table-column
							prop="userName"
							align="center"
							label="项目"
						>
							<template slot-scope="scope">
								{{ scope.row.venueName }}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="会员有效投注"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.clubAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="团队返点比例"
						>
							<template slot-scope="scope">
								{{
									scope.row.venueName == '合计'
										? '-'
										: scope.row.rebateRate + '%'
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="团队返点金额"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.rebateAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="团队占成比例"
						>
							<template slot-scope="scope">
								{{
									scope.row.venueName == '合计'
										? '-'
										: scope.row.zhanchengRate + '%'
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="partRebateAmount"
							align="center"
							label="返点成本分摊"
						>
							<template
								slot="header"
								slot-scope="{ column, $index }"
							>
								<span>
									返点成本分摊
									<el-tooltip
										class="item"
										effect="dark"
										placement="top-start"
									>
										<div slot="content">
											返点成本分摊=团队返点成本分摊-下级返点成本分摊
										</div>
										<i class="el-icon-question"></i>
									</el-tooltip>
								</span>
							</template>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.partRebateAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="直属代理团队返点金额"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.underProxyAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="会员代理返水"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.memberRebateAmountByProxy
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="实际应发返点金额"
						>
							<template
								slot="header"
								slot-scope="{ column, $index }"
							>
								<span>
									实际应发返点金额
									<el-tooltip
										class="item"
										effect="dark"
										placement="top-start"
									>
										<div slot="content">
											实际应发返点金额=团队返点金额-直属代理团队返点金额-会员代理返水
										</div>
										<i class="el-icon-question"></i>
									</el-tooltip>
								</span>
							</template>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.incomeAmount
									)
								}}
							</template>
						</el-table-column>
					</el-table>

					<el-table
						v-loading="loading"
						element-loading-spinner="el-icon-loading"
						size="mini"
						class="small-size-table"
						:data="incomeAuditDetail2"
						style="width: 100%; margin: 15px 0"
						:header-cell-style="getRowClass"
						highlight-current-row
					>
						<el-table-column
							prop="userName"
							align="center"
							label="项目"
						>
							<template slot-scope="scope">
								{{ scope.row.venueName }}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="累计会员游戏输赢"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.netAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="团队占成比例"
						>
							<template slot-scope="scope">
								{{
									scope.row.venueName == '合计'
										? '-'
										: scope.row.zhanchengRate + '%'
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="团队占成金额"
						>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.commissionNetAmount
									)
								}}
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="直属代理团队占成金额"
						>
							<template slot-scope="scope">
								<p
									:style="
										handleNumberColor(
											scope.row.underProxyNetAmount
										)
									"
								>
									{{
										handleTotalNumber(
											'USDT',
											scope.row.underProxyNetAmount
										)
									}}
								</p>
							</template>
						</el-table-column>
						<el-table-column
							prop="userName"
							align="center"
							label="实际应发占成金额"
						>
							<template
								slot="header"
								slot-scope="{ column, $index }"
							>
								<span>
									实际应发占成金额
									<el-tooltip
										class="item"
										effect="dark"
										placement="top-start"
									>
										<div slot="content">
											实际应发占成金额=团队占成金额-直属代理团队占成金额
										</div>
										<i class="el-icon-question"></i>
									</el-tooltip>
								</span>
							</template>
							<template slot-scope="scope">
								{{
									handleTotalNumber(
										'USDT',
										scope.row.incomeNetAmount
									)
								}}
							</template>
						</el-table-column>
					</el-table>

					<template
						v-if="detailData.proxyName === selectedData.userName"
					>
						<div
							class="block mt20 pr10"
							v-if="auditDetail.audit1Operator"
						>
							<p class="name">
								{{ $t('funds.fund_audit.audit_info') }}
							</p>
							<div class="block-content">
								<el-row>
									<el-col :span="8" :offset="0">
										{{
											$t('funds.fund_audit.audit_user_1')
										}}:
										{{ auditDetail.audit1Operator || '-' }}
									</el-col>
									<el-col :span="8" :offset="0">
										{{
											$t('funds.fund_audit.audit_time_1')
										}}:
										{{ auditDetail.audit1Time || '-' }}
									</el-col>
									<el-col :span="8" :offset="0">
										{{
											$t(
												'funds.fund_audit.audit_remark_1'
											)
										}}:
										<span class="txtfeed">
											{{ auditDetail.audit1Desc || '-' }}
										</span>
									</el-col>
								</el-row>
							</div>
							<div
								v-if="auditDetail.audit2Operator"
								class="block-content"
							>
								<el-row>
									<el-col :span="8" :offset="0">
										{{
											$t('funds.fund_audit.audit_user_2')
										}}:
										{{ auditDetail.audit2Operator || '-' }}
									</el-col>
									<el-col :span="8" :offset="0">
										{{
											$t('funds.fund_audit.audit_time_2')
										}}:
										{{ auditDetail.audit2Time || '-' }}
									</el-col>
									<el-col :span="8" :offset="0">
										{{
											$t(
												'funds.fund_audit.audit_remark_2'
											)
										}}:
										<span class="txtfeed">
											{{ auditDetail.audit2Desc || '-' }}
										</span>
									</el-col>
								</el-row>
							</div>
						</div>
					</template>
				</div>
				<RebateBouns
					v-else
					:selectedData="selectedData"
					:detailData="detailData"
				/>
				<ClubAmountDialog
					v-if="clubAmountDialog"
					:visible.sync="clubAmountDialog"
					@handleVisible="clubAmountDialog = false"
					:curData="clubAmountVal"
				></ClubAmountDialog>
			</div>
		</div>
	</div>
</template>

<script>
import list from '@/mixins/list'
import dayjs from 'dayjs'
import SeaMoonDialog from '@/components/SeaMoon'
import CommonProxyTree from '@/components/CommonProxyTree/index'
import RebateBouns from '@/components/Funds/RebateBouns'
import ProxyRebate from '@/components/Funds/ProxyRebate'
import ClubAmountDialog from './clubAmountDialog.vue'
export default {
	components: {
		SeaMoonDialog,
		ClubAmountDialog,
		CommonProxyTree,
		RebateBouns,
		ProxyRebate
	},
	mixins: [list],
	props: {
		detailData: {
			type: Object,
			required: true
		}
	},
	data() {
		return {
			dayjs,
			proxyAccountInfo: {},
			proxyIncomeList: [],
			tableLoading: false,
			selectedData: {
				type: 1,
				userName: ''
			},
			clubAmountDialog: false,
			clubAmountVal: null,
			// 活跃弹窗
			activeNumDialog: {
				rowData: {},
				loading: false,
				visible: false,
				title: '活跃人数',
				type: 1, // 1:active  2:validActive
				tableData: [],
				page: {
					total: 0,
					loading: false,
					pageNum: 1,
					pageSize: 100
				}
			},
			// 规则弹窗
			rulesDialog: {
				visible: false,
				level: undefined,
				tableData: []
			},
			// 审核弹窗
			auditDialog: {
				loading: false,
				visible: false,
				result: undefined,
				remark: undefined
			},
			seaMoon: {
				isAudit: false,
				visible: false,
				params: {}
			},
			incomeAuditDetail1: [],
			incomeAuditDetail2: [],
			incomeAuditDetail3: [],
			auditDetail: {}
		}
	},
	computed: {
		formRules() {
			return {
				remark: [
					{
						required: true,
						message: this.$t('funds.fund_audit.form_rules_tip2'),
						trigger: 'blur'
					},
					{
						min: 2,
						max: 500,
						message: this.$t('funds.fund_audit.form_rules_tip2'),
						trigger: 'blur'
					}
				]
			}
		},
		proxyCreatedAtEnd() {
			return dayjs(String(this.detailData?.endTime)).format(
				'YYYY-MM-DD 23:59:59'
			)
		},
		realIncomeData() {
			return [
				{
					realIncomeAmount: this.detailData.realIncomeAmount,
					adjustIncomeAmount: this.detailData.adjustIncomeAmount,
					currentIncomeAmount: this.detailData.currentIncomeAmount,
					payoutStatus: this.detailData.payoutStatus,
					audit1Desc: this.detailData.audit1Desc,
					audit2Desc: this.detailData.audit2Desc
				}
			]
		}
	},
	watch: {
		selectedData: {
			handler(next) {
				if (next.type === 1 && next.userName) {
					// this.proxyRebateDetail = {
					// 	proxyId: this.selectedData.id,
					// 	reportType: this.activeTab,
					// 	reportDate: this.detailData.reportDate
					// }
					// this.selecteSumaryKey = Math.random()
					// this.selecteDetailKey = Math.random()
					// this.getProxyAccountDetail()
					this.getData()
				}
			},
			immediate: true
		}
	},
	created() {},
	mounted() {
		// this.getData()
	},
	methods: {
		clubAmountDialogFn() {
			this.clubAmountVal = this.auditDetail
			console.log(this.clubAmountVal, 'clubAmountVal')
			this.clubAmountDialog = true
		},
		getData() {
			this.loading = true
			this.$api
				.queryAgentDetailNew({
					reportDate: this.detailData.reportDate,
					merchantId: this.detailData.merchantId,
					proxyName:
						this.selectedData.userName || this.detailData.proxyName
				})
				.then((res) => {
					if (res?.code === 200) {
						this.proxyAccountInfo = res.data || {}
					}
				})
			this.$api
				.proxyIncomeList({
					cycleStartDate: this.detailData.startTime,
					cycleEndDate: this.detailData.endTime,
					proxyName: this.selectedData.userName
				})
				.then((res) => {
					if (res?.code === 200) {
						this.proxyIncomeList = res.data.record || []
						this.$api
							.proxyIncomeAuditDetail({
								id: res.data.record[0].orderNo
							})
							.then((res) => {
								this.loading = false
								this.auditDetail = res.data
								this.incomeAuditDetail1 =
									(res.data.fundsAuditDetailRespList &&
										res.data.fundsAuditDetailRespList.filter(
											(ele) =>
												ele.venueName.includes('俱乐部')
										)) ||
									[]
								this.incomeAuditDetail3 =
									(res.data.fundsAuditDetailRespList &&
										res.data.fundsAuditDetailRespList.filter(
											(ele) =>
												ele.venueName.includes('增值')
										)) ||
									[]
								this.incomeAuditDetail2 =
									(res.data.fundsAuditDetailRespList &&
										res.data.fundsAuditDetailRespList.filter(
											(ele) =>
												!ele.venueName.includes('德州')
										)) ||
									[]
							})
							.catch(() => {
								this.loading = false
							})
					}
				})
		},
		onSeaMoonValidSucceed(data) {
			if (this.seaMoon.isAudit) {
				this.handleAudit()
			}
		},
		openSeaMoonDialog(isAudit) {
			this.$refs.reviwewForm.validate((valid) => {
				if (valid) {
					this.handleAudit()
				}
			})
		},
		tableRowClassName({ row, rowIndex }) {
			return row.level === this.rulesDialog.level ? 'high-light' : ''
		},
		goBack() {
			this.$emit('goBack')
		},
		// 一审二审弹窗
		openAuditDialog(status) {
			this.auditDialog.result = status
			this.auditDialog.visible = true
		},
		closeAuditDialog() {
			this.$refs.reviwewForm.resetFields()
		},
		handleAudit() {
			this.auditDialog.loading = true
			const params = {
				ids: [this.detailData.orderNo],
				auditStatus: this.auditDialog.result,
				remark: this.auditDialog.remark
			}
			const loading = this.$loading({
				lock: true,
				text: 'Loading',
				spinner: 'el-icon-loading',
				background: 'rgba(0, 0, 0, 0.7)'
			})
			this.$api
				.proxyIncomeAuditRecord(params)
				.then((res) => {
					loading.close()
					this.$message({
						type: 'success',
						message: this.$t('common.action_success')
					})
					this.visible = false
					this.auditDialog.loading = false
					this.$emit('goBack', true)
				})
				.catch(() => {
					loading.close()
					this.visible = false
					this.auditDialog.loading = false
				})
		}
	}
}
</script>

<style lang="scss" scoped>
.tree-box {
	width: 320px;
	flex-shrink: 0;
	height: auto;
	overflow: auto;
	::v-deep .el-card__body {
		padding-left: 0px;
		width: 100%;
	}
}
::v-deep .el-tabs__item {
	font-size: 16px;
	font-weight: bold;
}
.treeRight {
	width: calc(100% - 245px);
	// display: flex;
	// -o-display: flex;
	// -ms-display: flex;
	// -webkit-display: flex;
	// -moz-display: flex;
	// flex-direction: column;
	// -o-flex-direction: column;
	// -ms-flex-direction: column;
	// -webkit-flex-direction: column;
	// -moz-flex-direction: column;
	overflow-y: auto;
	overflow-x: hidden;
}
.txtfeed {
	width: 160px;
	table-layout: fixed;
	word-break: break-all;
	overflow: hidden;
}
.audit-wrapper {
	color: #666666;
	margin: 24px 16px 20px 16px;
	.head {
		height: 70px;
		line-height: 70px;
		width: 100%;
		background: #000;
		border-radius: 2px;
		padding: 0 30px;
		.title {
			font-weight: 600;
			color: rgb(192, 190, 190);
		}
		.right-btn {
			float: right;
		}
	}

	.audit-content {
		.block {
			padding: 10px 30px 0px 30px;
			.name {
				font-weight: 600;
				color: #303133;
			}
			.block-content {
				position: relative;
				width: 100%;
				margin-top: 15px;
			}
		}
		.rebate-details {
			padding-bottom: 20px;
			.details-page {
				margin-top: 10px;
				position: absolute;
				right: 0;
			}
		}
	}
}

.count-single-row {
	height: 40px;
	p {
		height: 40px;
		line-height: 40px;
		color: #5c5c5c;
		font-weight: 700;
		span {
			display: inline-block;
			width: 20px;
			height: 20px;
		}
	}
}

.audit-dialog {
	::v-deep .el-dialog__header {
		color: #909399;
		font-weight: 700;
		text-align: center;
	}
}

.active-dialog {
	::v-deep .el-dialog__header {
		padding: 10px 20px 10px;
	}
	::v-deep .el-dialog__body {
		padding: 20px 20px;
	}
	.tabs-wrapper {
		display: flex;
		.tab {
			width: 120px;
			height: 40px;
			line-height: 40px;
			text-align: center;
			border: 1px solid rgba(0, 0, 0, 0.15);
			font-size: 14px;
			font-weight: 600;
			color: #000000a3;
			cursor: pointer;
			margin-right: 20px;
		}
	}
	.active {
		background: #00bfbf;
	}
	.type-name {
		padding: 0 0 20px;
		font-weight: 600;
		.num {
			color: blue;
		}
	}
}
::v-deep .el-table {
	.high-light {
		color: #0dc5e3;
	}
}
.detailBoxStyle {
	border: none !important;
	margin-top: 10px;
	overflow: hidden;
}

::v-deep .rempadding .el-dialog__header {
	color: #909399;
	font-weight: 700;
}
::v-deep .rempadding .el-dialog__body {
	padding: 0;
	padding-bottom: 30px;
	.contentBox {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.contentBox,
	form {
		padding: 0 20px;
	}
}

::v-deep .el-icon-question:after {
	font-size: 16px;
	margin-left: 0;
}
</style>
